home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / RMTP03.ARJ / READDEF.PAS < prev    next >
Pascal/Delphi Source File  |  1992-02-25  |  2KB  |  56 lines

  1. Program ReadDef;
  2.     Uses Graph;
  3. Var
  4.  Gd : Integer;
  5.  Gm : Integer;
  6.  F  : Text;
  7.  Ch : Char;
  8.  Col: Word;
  9.  SX : Word;
  10.  X,Y: Word;
  11. Begin
  12.  Gd:=EGA;
  13.  Gm:=EGAhi;
  14.  InitGraph(Gd,Gm,'');            (* Set path where EGAVGA.BGI*)
  15.                                  (* is located               *)
  16.  
  17.  
  18.  SetFillStyle(SolidFill,Blue);
  19.  Bar(0,0,639,349);
  20.  
  21.  X:=260;
  22.  Y:=120;                         (* Starting position                    *)
  23.  
  24.  
  25.  SX:=X;
  26.  Assign(F,'rm.def');             (* Rm.def must be in current directory  *)
  27.  Reset(F);
  28.  Repeat
  29.   Ch:=' ';
  30.   Repeat
  31.    Read(F,Ch);                   (* Read a character                     *)
  32.    Col:=0;
  33.    Case Ord(Ch) of
  34.     48..57:Begin
  35.             Col:=Ord(Ch)-48;     (* Convert Hex character to             *)
  36.             PutPixel(SX,Y,Col);  (* number. From 0 to 9                  *)
  37.            End;
  38.     65..70:Begin
  39.             Col:=Ord(Ch)-55;     (* Convert Hex character to             *)
  40.             PutPixel(SX,Y,Col);  (* number. From 10 to 15                *)
  41.            End;
  42.    End;
  43.    Inc(SX);
  44.   Until Ch=chr(13);(* Repeat loop until we hit a carriage return         *)
  45.   Read(F,Ch);      (* Should be a line feed, we just read it             *)
  46.   Inc(Y);          (* Increase Y by 1                                    *)
  47.   SX:=X;           (* Set SX to X                                        *)
  48.  Until Eof(F);     (* Keep repeating until we reach the end of the file  *)
  49.  Close(F);
  50.  
  51.  Readln;           (* Wait for enter key                                 *)
  52.  
  53.  Closegraph;       (* Close graphics                                     *)
  54.  
  55. End.
  56.